CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = 0.1
bindir = @bindir@
DESTDIR=/var/bpack/

bpack: src/error.o src/search.o src/terminal.o src/remove.o src/update.o src/main.o src/config.o src/installscript.o src/storage.o src/packinst.o src/version.o src/install.o src/package.o src/scan.o libs/hijack.so.1.0 src/qhttp.o packs.list
	$(CXX) $(CXXFLAGS) src/error.o src/update.o src/qhttp.o src/terminal.o src/search.o src/remove.o src/main.o src/config.o src/installscript.o src/storage.o src/packinst.o src/version.o src/install.o src/package.o src/scan.o -o bpack

src/qhttp.o: src/qhttp.c src/qhttp.h
	$(CC) -c $(CFLAGS) src/qhttp.c -o src/qhttp.o

src/terminal.o: src/terminal.cpp src/terminal.hpp
	$(CXX) -c $(CXXFLAGS) src/terminal.cpp -o src/terminal.o

src/error.o: src/error.cpp src/error.hpp
	$(CXX) -c $(CXXFLAGS) src/error.cpp -o src/error.o

src/search.o: src/search.cpp src/search.hpp
	$(CXX) -c $(CXXFLAGS) src/search.cpp -o src/search.o

src/remove.o: src/remove.cpp src/remove.hpp
	$(CXX) -c $(CXXFLAGS) src/remove.cpp -o src/remove.o

src/main.o: src/main.cpp
	$(CXX) -c $(CXXFLAGS) src/main.cpp -o src/main.o

src/config.o: src/config.cpp src/config.hpp
	$(CXX) -c $(CXXFLAGS) src/config.cpp -o src/config.o

src/installscript.o: src/installscript.cpp src/installscript.hpp
	$(CXX) -c $(CXXFLAGS) src/installscript.cpp -o src/installscript.o

src/storage.o: src/storage.cpp src/storage.hpp
	$(CXX) -c $(CXXFLAGS) src/storage.cpp -o src/storage.o

src/packinst.o: src/packinst.cpp src/packinst.hpp
	$(CXX) -c $(CXXFLAGS) src/packinst.cpp -o src/packinst.o

src/version.o: src/version.cpp src/version.hpp
	$(CXX) -c $(CXXFLAGS) src/version.cpp -o src/version.o

src/install.o: src/install.cpp src/install.hpp
	$(CXX) -c $(CXXFLAGS) src/install.cpp -o src/install.o

src/package.o: src/package.cpp src/package.hpp
	$(CXX) -c $(CXXFLAGS) src/package.cpp -o src/package.o

src/scan.o: src/scan.cpp src/scan.hpp
	$(CXX) -c $(CXXFLAGS) src/scan.cpp -o src/scan.o

src/update.o: src/update.cpp src/update.hpp
	$(CXX) -c $(CXXFLAGS) src/update.cpp -o src/update.o

clean:
	rm -f src/terminal.o src/update.o src/search.o src/remove.o src/main.o src/config.o	src/installscript.o src/storage.o src/packinst.o src/version.o src/install.o src/package.o src/scan.o bpack libs/hijack.so.1.0 src/qhttp.o src/error.o

libs/hijack.so.1.0: src/hijack.c
	$(CC) -fPIC -c src/hijack.c -fno-stack-protector
	$(LD) -shared -soname hijack.so.1 -o libs/hijack.so.1.0 -lc hijack.o -ldl

packs.list:
	touch packs.list

install: bpack libs/hijack.so.1.0
	mkdir -p $(DESTDIR)
	mkdir -p $(DESTDIR)/tarballs
	mkdir -p $(DESTDIR)/packs
	mkdir -p $(DESTDIR)/libs
	cp -f  bpack $(bindir)/bpack
	touch $(DESTDIR)/packs.list
	touch /etc/bpack.conf

	
